unit FormSelectDir;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, FileCtrl;

type
  TFSelectDir = class(TForm)
    DirList: TDirectoryListBox;
    BtOk: TButton;
    CurrentDir: TEdit;
    procedure CurrentDirChange(Sender: TObject);
    procedure BtOkClick(Sender: TObject);
    procedure DirSelected;
    procedure DirListChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FSelectDir: TFSelectDir;

implementation

uses Main;

{$R *.DFM}

procedure TFSelectDir.DirSelected;
begin
     Fmain.Path_CDFTP.Text:=CurrentDir.Text;
     Hide;
end;

procedure TFSelectDir.CurrentDirChange(Sender: TObject);
begin
     if DirectoryExists(CurrentDir.Text) then
        DirList.Directory:=CurrentDir.Text;
end;



procedure TFSelectDir.BtOkClick(Sender: TObject);
begin
     DirSelected;
end;

procedure TFSelectDir.DirListChange(Sender: TObject);
begin
     if (CurrentDir.Text<>DirList.Directory) or (CurrentDir.Text+'\'<>DirList.Directory) 
        then
            CurrentDir.Text:=DirList.Directory
end;

end.
